<?php
class Mapper_News extends DBTable{
	
	public function __construct(Database $db){
		parent::__construct($db, "news");
	}
	
	public function __get($var){
		return $this->get($var);
	}
	
	public function get($news_id){
		$query	=	"
					SELECT
						*
					FROM
						news
					WHERE
						news_id = :news_id;";
		$stmt = $this->db->prepare($query);
		$stmt->bindParam(":news_id",$news_id);
		return $stmt->fetchObjectOnce('News');
	}
	
	public function getAll(){
		$query	=	"SELECT
						*
					FROM
						news
					ORDER BY news_date DESC";
		$stmt = $this->db->prepare($query);
		return $stmt->fetchObjectAll('News');
	}
}